package com.xiao.watch_tool;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @CreateBy 花和尚  1130365579@qq.com  2023/3/10 16:43
 * @Version 1.0
 */
public class JConsoleTestCaseThread {
    public static void createBusyThread() {
        new Thread(() -> {
            while (true) ;
        }, "testBusyThread").start();
    }

    public static void createLockThread(Object lock) {
        new Thread(() -> {
            synchronized (lock) {
                try {
                    lock.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }, "testLockThread").start();
    }

    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        // 创建死循环线程
        bufferedReader.readLine();
        createBusyThread();
        // 创建等待锁线程
        bufferedReader.readLine();
        createLockThread(new Object());
    }
}
